home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / prog_c / bc4lib.zip / KEYBOARD.H < prev    next >
C/C++ Source or Header  |  1994-03-08  |  1KB  |  58 lines

  1.  
  2.  
  3. /* this include file gives you INTERRUPT DRIVEN KEYBOARD INPUT !
  4.  
  5.    perfect for keyboard driven realtime simulator games !
  6.  
  7.    starkeyboard - saves the old int 9 (keyboard interrupt) handler
  8.           addresss, and installs a new int 9 handler. the
  9.           new handler updates an array that tracks the state
  10.           (pressed or not pressed) of the keys, and then calls the
  11.           old int 9 handler.
  12.  
  13.    keypressed(i) - looks up the current state of the key with scancode i.
  14.            returns 1 if key with scancode i is pressed, else
  15.            returns 0.
  16.  
  17.    stopkeyboard - restores the old int 9 handler.
  18.  
  19.    */
  20.  
  21.  
  22.  
  23.  
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. void startkeyboard(void);
  32. /* clears keys array, saves old int 9 handler address, installs new int 9
  33.    handler.
  34.  
  35.    call once before accessing keys array */
  36.  
  37.  
  38.  
  39.  
  40. void stopkeyboard(void);
  41. /* restores old int 9 handler. call when done accessing keys array */
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. int keypressed(int i);
  49. /* returns 1 if key pressed, else returns 0. i is the key's scancode */
  50.  
  51.  
  52.  
  53.  
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57.  
  58.